package Stream;

import java.util.stream.Stream;

public class Stream3 {
    public static void main(String[] args) {
        Stream<String> stream = Stream.of("张三","李四","王五","赵六","田七","张九龄");
        Stream stream2 = stream.filter((String name)->{return name.startsWith("张");});
        //这个方法返回的还是一个stream流,可以用一个新的stream来接收
        stream2.forEach((name)->{
            System.out.println(name);
        });
        //Stream属于管道流,只能被使用一次
        //数据的流动是单向的,前面的流使用后就不能再使用了

    }
}
